package com.wlyuan.open.infrastructure.converter;

import com.wlyuan.core.domain.MappingIds;
import com.wlyuan.core.marker.MappingStatus;
import com.wlyuan.open.dao.entity.OpenApiInfoLogDO;
import com.wlyuan.open.domain.api.OpenApiInfoLog;
import com.wlyuan.open.domain.api.utils.MappingOpenApiInfoLog;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Converter
 *
 * @author lijing
 */
public class OpenApiInfoLogConverter {
    @Mapper(uses = {
            MappingIds.class,
            MappingStatus.class,
            MappingOpenApiInfoLog.class
    })
    public interface Converter {
        OpenApiInfoLog convert(OpenApiInfoLogDO source);

        List<OpenApiInfoLog> convert(List<OpenApiInfoLogDO> source);

        @InheritInverseConfiguration
        OpenApiInfoLogDO convert(OpenApiInfoLog source);
    }

    private static final Converter CONVERTER = Mappers.getMapper(Converter.class);

    public static OpenApiInfoLogDO convert(OpenApiInfoLog source) {
        return CONVERTER.convert(source);
    }

    public static OpenApiInfoLog convert(OpenApiInfoLogDO source) {
        return CONVERTER.convert(source);
    }

    public static List<OpenApiInfoLog> convert(List<OpenApiInfoLogDO> source) {
        return CONVERTER.convert(source);
    }

}
